<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>后台登录-X-admin2.0</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />

        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
    </head>
    <body>
        <div class="x-body">    
			<div class="layui-row">
			    <div class="layui-col-md6 layui-col-sm12 layui-col-lg6">
			      <div class="grid-demo"><div id="main" style="width: 100%;height:400px;"></div></div>
			    </div>
			    <div class="layui-col-md6 layui-col-sm12 layui-col-lg6">
			      <div class="grid-demo grid-demo-bg1"><div id="mains" style="width: 100%;height:400px;"></div></div>
			    </div>
			</div>	
        </div>
        <script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
        <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: '年统计',
                left: '3%',
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['会员数量','商品销量','销售额']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
		            name:'会员数量',
		            type:'line',
		            stack: '总量',
		            data:[120, 132, 101, 134, 90, 230, 210, 134, 90, 230, 210, 134]
		        },
		        {
		            name:'商品销量',
		            type:'line',
		            stack: '总量',
		            data:[220, 182, 191, 234, 290, 330, 310, 234, 290, 330, 310, 310]
		        },
		        {
		            name:'销售额',
		            type:'line',
		            stack: '总量',
		            data:[150, 232, 201, 154, 190, 330, 410, 154, 190, 330, 410, 410]
		        }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
    
    <script type="text/javascript">
var dom = document.getElementById("mains");
var myChart = echarts.init(dom);
var app = {};
option = null;
var posList = [
    'left', 'right', 'top', 'bottom',
    'inside',
    'insideTop', 'insideLeft', 'insideRight', 'insideBottom',
    'insideTopLeft', 'insideTopRight', 'insideBottomLeft', 'insideBottomRight'
];

app.configParameters = {
    rotate: {
        min: -90,
        max: 90
    },
    align: {
        options: {
            left: 'left',
            center: 'center',
            right: 'right'
        }
    },
    verticalAlign: {
        options: {
            top: 'top',
            middle: 'middle',
            bottom: 'bottom'
        }
    },
    position: {
        options: echarts.util.reduce(posList, function (map, pos) {
            map[pos] = pos;
            return map;
        }, {})
    },
    distance: {
        min: 0,
        max: 100
    }
};

app.config = {
    rotate: 0,
    align: 'left',
    verticalAlign: 'middle',
    position: 'insideBottom',
    distance: 15,
    onChange: function () {
        var labelOption = {
            normal: {
                rotate: app.config.rotate,
                align: app.config.align,
                verticalAlign: app.config.verticalAlign,
                position: app.config.position,
                distance: app.config.distance
            }
        };
        myChart.setOption({
            series: [{
                label: labelOption
            }, {
                label: labelOption
            }, {
                label: labelOption
            }, {
                label: labelOption
            }]
        });
    }
};


var labelOption = {
    normal: {
        show: true,
        position: app.config.position,
        distance: app.config.distance,
        align: app.config.align,
        verticalAlign: app.config.verticalAlign,
        rotate: app.config.rotate,
        formatter: '{c}  {name|{a}}',
        fontSize: 16,
        rich: {
            name: {
                textBorderColor: '#fff'
            }
        }
    }
};

option = {
    color: ['#003366', '#e5323e', '#4cabce'],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['会员数量', '商品销量', '销售额']
    },
    toolbox: {
        show: true,
       /* orient: 'vertical',
        left: 'right',
        top: 'center',*/
        feature: {
          /*  mark: {show: true},
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
            restore: {show: true},*/
            saveAsImage: {show: true}
        }
    },
    calculable: true,
    xAxis: [
        {
            type: 'category',
            axisTick: {show: false},
            data: ['第一季度', '第二季度', '第三季度', '第四季度']
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            name: '会员数量',
            type: 'bar',
            barGap: 0,
            /*label: labelOption,*/
            data: [320, 332, 301, 334]
        },
        {
            name: '商品销量',
            type: 'bar',
            /*label: labelOption,*/
            data: [220, 182, 191, 234]
        },
        {
            name: '销售额',
            type: 'bar',
            /*label: labelOption,*/
            data: [150, 232, 201, 154]
        }
      
    ]
};;
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
       </script>
    </body>
</html>